package myschool.array.homework;

public class ScoreSorting {
    /**
     * 要求对5个班各5名学生某门课程的成绩进行各种操作，如何实现？（二维数组初始化）
     */
    public static void main(String[] args) {
        int[][] score ={{98,88,77,66,57},{55,68,97,95},{95,92,96,97},{66,88,77,55,56},{95,98,99,64,55}};
        int number;
        for (int i = 0; i < score.length; i++) {
            for (int j = 0; j < score[i].length-1; j++) {
                for (int k = score[i].length-1; k < j; k--) {
                    if (score[j][k] < score[j][k-1]){
                        number = score[j][k];
                        score[j][k] = score[j][k-1];
                        score[j][k-1] = number;
                    }
                }

            }
        }
        for (int i = 0; i < score.length; i++) {
            System.out.println("第"+(i+1)+"组");
            for (int j = 0; j < score[i].length; j++) {

            System.out.print(score[i][j]+"\t");
            }
            System.out.println("");
        }


    }
}
